package com.qpf.mycms.api.pojo;

import com.qpf.mycms.api.abstracts.BaseEntity;
import com.qpf.mycms.api.abstracts.BaseRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@Schema(description = "用户请求对象")
public class UserRequest extends BaseRequest implements Serializable {
    /**
     * 主键ID
     */
    @Schema(title = "主键ID", name = "id")
    private Long id;

    /**
     * 账号
     */
    @Length(min = 2, max = 20, message = "用户名长度在2到20之间", groups={SysUserInsertInterface.class})
    @NotBlank(message = "账号不能为空", groups={SysUserInsertInterface.class, SysUserLoginInterface.class})
    @Schema(title = "账号", name = "account")
    private String account;
    /**
     * 用户名
     */
    @Length(min = 2, max = 20, message = "用户名长度在2到20之间", groups={MemberUserInsertInterface.class, MemberUserLoginInterface.class})
    @NotBlank(message = "账号不能为空", groups={MemberUserInsertInterface.class})
    @Schema(title = "用户名", name = "username")
    private String username;

    /**
     * 昵称
     */
    @Schema(title = "昵称", name = "nickname")
    private String nickname;

    /**
     * 实名
     */
    @Schema(title = "实名", name = "realName")
    private String realName;

    /**
     * 类型(0-未知)
     */
    @Schema(title = "类型", name = "userType")
    private Integer userType;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空", groups={BaseEntity.Insert.class})
    @Schema(title = "密码", name = "password")
    private String password;

    /**
     * 身份
     */
    @Schema(title = "身份", name = "identity")
    private String identity;

    /**
     * 匿名ID
     */
    @Schema(title = "匿名ID", name = "antonym")
    private String antonym;
    /**
     * 邮箱
     */
    @Email(message = "邮箱格式不正确", groups={MemberUserInsertInterface.class, SysUserInsertInterface.class, BaseEntity.Update.class})
    @Schema(title = "邮箱", name = "email")
    private String email;

    /**
     * 手机号码 "^1[3-9]\\d{9}$"
     */
    @Pattern(regexp = "^1[3456789]\\d{9}$", message = "手机号码格式不正确", groups={MemberUserInsertInterface.class, SysUserInsertInterface.class, BaseEntity.Update.class})
    @Schema(title = "手机号码", name = "mobile")
    private String mobile;

    /**
     * 用户性别(0-未知,1-男,2-女)
     */
    @Schema(title = "用户性别(0-未知,1-男,2-女)", name = "gender")
    private Integer gender;

    /**
     * 签名
     */
    @Schema(title = "签名", name = "signature")
    private String signature;

    /**
     * 个性签名
     */
    @Schema(title = "个性签名", name = "selfSignature")
    private String selfSignature;

    /**
     * 生日
     */
    @Schema(title = "生日", name = "birthday")
    private Date birthday;

    /**
     * 公司
     */
    @Schema(title = "公司", name = "company")
    private String company;

    /**
     * 职位
     */
    @Schema(title = "职位", name = "occupation")
    private String occupation;

    /**
     * 邮政编码
     */
    @Schema(title = "邮政编码", name = "zipcode")
    private String zipcode;

    /**
     * 个人网址
     */
    @Schema(title = "个人网址", name = "site")
    private String site;

    /**
     * 毕业学校
     */
    @Schema(title = "毕业学校", name = "graduateSchool")
    private String graduateSchool;

    /**
     * 学历
     */
    @Schema(title = "学历", name = "education")
    private String education;

    /**
     * 证件类型
     */
    @Schema(title = "证件类型", name = "idCardType")
    private String idCardType;

    /**
     * 证件号码
     */
    @Schema(title = "证件号码", name = "idCard")
    private String idCard;
    /**
     * 扩展信息
     */
    @Schema(title = "扩展信息", name = "extra")
    private Object extra;

    public interface SysUserInsertInterface {}
    public interface MemberUserInsertInterface {}
    public interface SysUserLoginInterface {}
    public interface MemberUserLoginInterface {}
}
